function  [c,w,z,max_it] = biseccion(f,a,b,m_error,z,max_it)

    c = (b+a)/2;
    z = [c,z];
    if(abs(f(c)) < m_error)
        w = f(c);
    else
        if(f(a)*f(b) < 0 )
            if(f(a)* f(c) < 0)
                b = c;
            else
                a = c;
            endif
            max_it++;
            [c,w,z,max_it] = biseccion(f,a,b,m_error,z,max_it);
        else
          fprintf("ingrese nuevos valores para a y b\n")
        endif
    endif
endfunction
%se corre con biseccion(2,4,0.02,@(x) sin(x),[])    

